package fr.pascal.client.mvp;

import com.google.gwt.activity.shared.Activity;
import com.google.gwt.activity.shared.ActivityMapper;
import com.google.gwt.place.shared.Place;

import fr.pascal.client.ClientFactory;
import fr.pascal.client.activity.ChatActivity;
import fr.pascal.client.activity.KangourouActivity;
import fr.pascal.client.place.ChatPlace;
import fr.pascal.client.place.KangourouPlace;

public class AppActivityMapper implements ActivityMapper {
	
	private ClientFactory clientFactory;
	
	public AppActivityMapper(ClientFactory clientFactory) {
		super();
		this.clientFactory = clientFactory;
	}

	@Override
	public Activity getActivity(Place place) {
		if (place instanceof ChatPlace) {
			return new ChatActivity(clientFactory, (ChatPlace) place);
		} else if (place instanceof KangourouPlace) {
			return new KangourouActivity(clientFactory, (KangourouPlace) place);
		}
		return null;
	}
}
